﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using System.Data;
namespace BUS
{
    public class ChiTietDonHangBUS
    {
         //Load Danh Sách Chi tiết đơn hàng theo mã đơn hàng
        public static DataTable LoadDanhSachChiTietTheoMaDH(string madh)
        {
            return ChiTietDonHangDAO.LoadDanhSachChiTietTheoMaDH(madh);
        }
        //Lay don hang cuoi cung
        public static int DonHangCuoiCung()
        {
            return ChiTietDonHangDAO.DonHangCuoi();
        }

        //Them Chi Tiet Don Hang
        public static void ThemChiTietDonHang(DataTable dt,string maDH)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ChiTietDonHangDAO.ThemChiTietDonHang(dt.Rows[i]["MaSP"].ToString(), dt.Rows[i]["SoLuong"].ToString(), dt.Rows[i]["DonGia"].ToString(), maDH);
            }
        }
    }
}
